#include <stdio.h>
#include <stdlib.h>
#include "camellia.h"
#include <time.h>

int main(int argc, char* argv[])
{
	CamImage source1, source2, dest;
	CamImage aSource2;
	camLoadBMP(&source1, argv[1]);
	camLoadBMP(&source2, argv[2]);
	camAllocateRGBAImage(&dest, source1.width, source1.height);
	camAllocateRGBAImage(&aSource2, source2.width, source2.height);
	camCopy(&source2, &aSource2);
	//camSet(&aSource2, 255);
	camFillColor(&aSource2, 200, 200, CAM_RGBA(255,0,0,128), 50);

	time_t beg = time(NULL);
	int i;
	const int iterations = 500;
	for(i = 0; i < iterations; i++)
		// source1 is an RGB image, aSource2 is an RGBA image.
		camAlphaComposite(&source1, &aSource2, &dest);
	time_t totalTime = time(NULL) - beg;
	printf("%u seconds for %d iterations\n", (unsigned int) totalTime, iterations);

	camSaveBMP(&dest, argv[3]);
}
